<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>getter/setter</title>
    <script src="../vue.global.js"></script>
    <style>
        .red{
            color:red;
        }
    </style>
</head>
<body>

<div id="App">
    {{fullUser}}
</div>


<script>



    const App = {

        data(){
            return {
                counter:10,
                province:"beijing",
                city:"天安门"
            }
        },

        computed:{
            // fullUser(){
            //     return this.province+"==="+this.city;
            // }
            fullUser:{
                get(){
                    return this.province+"=+="+this.city;
                },
                set(value){
                    //console.log(value)
                    const str = value.split(".");
                    this.province=str[0];
                    this.city = str[1];
                }
            }
        }
    };

    const vm = Vue.createApp(App).mount("#App")
    vm.fullUser="江苏.南京";

</script>
</body>
</html>